# Copyright (C) 2009 Paul Rudin
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
""" Some simple models for testing purposes, a model is any object
that has attributes called points and polys; each being a numpy
array."""

import numpy

class Model(object):

    point_type = numpy.float
    index_type = numpy.uint16

    def __init__(self, points, polys):
        self.points = numpy.array(points, self.point_type)
        self.polys = numpy.array(polys, self.index_type)

unit_cube = Model(
    numpy.array( [[0,0,0],
                  [1,0,0],
                  [1,1,0],
                  [0,1,0],
                  [0,0,1],
                  [1,0,1],
                  [1,1,1],
                  [0,1,1]],'f' ),
                         
    numpy.array([[0,1,2,3],
                 [0,1,5,4],
                 [1,2,6,5],
                 [2,3,7,6],
                 [3,0,4,7],
                 [4,5,6,7]], 'f'))

two_cube = Model(
    unit_cube.points * 2.0,
    unit_cube.polys)

ell = Model(
    numpy.array( [[0,0,0],
                  [0,1,0],
                  [2,1,0],
                  [2,0,0],
                  [0,0,1],
                  [0,1,1],
                  [2,1,1],
                  [2,0,1],
                  [1,0,1],
                  [1,1,1],
                  [1,0,3],
                  [1,1,3],
                  [2,1,3],
                  [2,0,3]], 'f'),
    numpy.array([[0,1,2,3],
                 [0,4,7,3],
                 [0,4,5,1],
                 [3,7,6,2],
                 [1,5,6,2],
                 [4,5,9,8],
                 [10,11,9,8],
                 [7,8,10,13],
                 [6,7,13,12],
                 [6,9,11,12],
                 [10,11,12,13]], 'f'))

# squashed ell - back same length as base
corner = Model(
    numpy.array( [[0,0,0],
                  [0,1,0],
                  [2,1,0],
                  [2,0,0],
                  [0,0,1],
                  [0,1,1],
                  [2,1,1],
                  [2,0,1],
                  [1,0,1],
                  [1,1,1],
                  [1,0,2],
                  [1,1,2],
                  [2,1,2],
                  [2,0,2]], 'f'),
    numpy.array([[0,1,2,3],
                 [0,4,7,3],
                 [0,4,5,1],
                 [3,7,6,2],
                 [1,5,6,2],
                 [4,5,9,8],
                 [10,11,9,8],
                 [7,8,10,13],
                 [6,7,13,12],
                 [6,9,11,12],
                 [10,11,12,13]], 'f'))
                  
                  
# L with very long back
long_ell = Model(
    numpy.array( [[0,0,0],
                  [0,1,0],
                  [2,1,0],
                  [2,0,0],
                  [0,0,1],
                  [0,1,1],
                  [2,1,1],
                  [2,0,1],
                  [1,0,1],
                  [1,1,1],
                  [1,0,10],
                  [1,1,10],
                  [2,1,10],
                  [2,0,10]], 'f'),
    numpy.array([[0,1,2,3],
                 [0,4,7,3],
                 [0,4,5,1],
                 [3,7,6,2],
                 [1,5,6,2],
                 [4,5,9,8],
                 [10,11,9,8],
                 [7,8,10,13],
                 [6,7,13,12],
                 [6,9,11,12],
                 [10,11,12,13]], 'f'))
